/*-------------------------------------------------------------------------
	created:	2010/09/16  17:50
	filename: 	e:\Project_SVN\Server\GamesScene\GameScene.h
	author:		Deeple

	purpose:
---------------------------------------------------------------------------*/
#pragma  once

#include "../Interface/GameHandle.h"
#include "../Interface/ObjectHandle.h"
#include "../CustomDefine/CustomMessage.h"

#define GameInterface GamePlayer

extern IGame* g_pGame;

class GameInterface : public ICallee
{
    // 对象被创建
	virtual void OnCreate(IGame* pScene, UI32 self);

	// 对象被销毁
	virtual void OnDestroy(IGame* pScene, UI32 self, bool bSysRunning);

	// 角色试图前往另一个场景
	virtual bool OnPreEntryScene(IGame* pScene,  UI32 player, EntryMod mod,UI32 destSceneMod,
                              UI32 destSceneId, bool& bCheckDoor);

    // 角色试图在场景内部进行传送
	virtual bool OnInnerTransport(IGame* pScene,  UI32 player, int x, int y);

	// 角色进入场景
	virtual void OnEntryScene(IGame* pScene, UI32 player);

	// 角色离开场景
	virtual void OnLeaveScene(IGame* pScene, UI32 player);

	// 角色正离开副本回到主场景
	virtual void OnLeavingCopy(IGame* pScene, UI32 player);

	// 对象的侦循环
	virtual void OnFrame(IGame* pScene, UI32 self, UI32 selfType, UI32 nFrame, OBJ_POSI_INFO* info);

	// 对象的心跳
	virtual void OnHeartBeat(IGame* pScene, UI32 self, UI32 selfType, UI32 nBeat, OBJ_POSI_INFO* info);

	// 对象收到命令
	virtual void OnCommand(IGame* pScene, UI32 sender, UI32 self, UI32 msgType, CMsgTyped* pmsg);

	// 玩家收到客户端的自定义消息
	virtual void OnCustom(IGame* pScene, UI32 self, UI32 msgType, CMsgTyped* pmsg);

	// 对象收到定时器消息
	virtual void OnTimer(IGame* pScene, UI32 self, UI32 timerId, UI32 interval_minisec, CMsgTyped* pmsg);

	// 玩家收到公共服务器消息
	virtual void OnGlobalMessage(IGame* pScene, UI32 self, UI32 msgType, CMsgTyped* pmsg);

	// 玩家查询其他角色状态的回应消息
	virtual void OnQueryPlayerStates(IGame* pScene, UI32 self, int count, CMsgTyped* plist, const char* para);

	// 玩家查询其他角色状态的回应消息
	virtual void OnQueryRoleInfo(IGame* pScene, UI32 self, int count, CMsgTyped* plist, const char* para);

	// 收到来自运营系统的控制命令， 用于冻结，禁言封号等运维功能
    virtual void OnControlMessage(IGame* pScene, UI32 self, UI32 type, const char* json);

	// 返回接口类型供底层识别
	virtual const char* GetInterfaceName(){return "GAME_PLAYER";}
};

extern GameInterface g_eventhandle;
